package com.fengxing.ams.web.common;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;

import com.fengxing.ams.pub.constants.Roles;
import com.fengxing.ams.pub.manager.intf.IConfigManager;
import com.fengxing.ams.web.facade.mouble.user.UserVO;

@Component
public class RequestContextFilter extends OncePerRequestFilter {
	
	@Autowired
	IConfigManager configManager;

	@Override
	protected void doFilterInternal(HttpServletRequest request,
			HttpServletResponse response, FilterChain filterChain)
			throws ServletException, IOException {
		
		response.addHeader("Access-Control-Allow-Origin", "*");
//		response.addHeader("Access-Control-Allow-Origin", "http://localhost:8989");
		response.addHeader("Access-Control-Allow-Headers", "content-type, x-requested-with");
		
		try {
			filterChain.doFilter(request, response);
		} finally {
		}
	}

}
